home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 10 / Example 10.1 / mapObject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-30  |  1.4 KB  |  46 lines

  1. #ifndef _MAP_OBJECT_
  2. #define _MAP_OBJECT_
  3.  
  4. #include "terrain.h"
  5. #include "intpoint.h"
  6. #include "mouse.h"
  7.  
  8. //Global Functions
  9. void LoadMapObjectResources(IDirect3DDevice9* Device);
  10. void UnloadMapObjectResources();
  11. INTPOINT GetScreenPos(D3DXVECTOR3 pos, IDirect3DDevice9* Device);
  12.  
  13. class MAPOBJECT
  14. {
  15.     public:
  16.         //Functions
  17.         MAPOBJECT();                    //Set all variables to 0
  18.         RECT GetMapRect(int border);    //Get map rectangle + border
  19.         void PaintSelected();            //Paint selected
  20.         void RenderSightMesh();                //Render sightTexture & mesh for this mapobject
  21.  
  22.         //Virtual Functions
  23.         virtual void Render() = 0;
  24.         virtual void Update(float deltaTime) = 0;
  25.         virtual BBOX GetBoundingBox() = 0;        //Bounding box in world space
  26.         virtual D3DXMATRIX GetWorldMatrix() = 0;
  27.  
  28.         //Variables
  29.         TERRAIN *m_pTerrain;            //Used for unit pathfinding, building placement etc
  30.         int m_hp, m_hpMax;                //Health and max health
  31.         int m_range;                    //Attack range
  32.         int m_damage;
  33.         INTPOINT m_mappos, m_mapsize;    //Location and mapsize
  34.         float m_sightRadius;
  35.         int m_team, m_type;
  36.         bool m_selected, m_dead;
  37.         std::string m_name;
  38.         MAPOBJECT *m_pTarget;            //Used for targeting both units and buildings
  39.         D3DXVECTOR3 m_position;        //Actual world position
  40.         IDirect3DDevice9* m_pDevice;
  41.  
  42.         bool m_isBuilding;            //Used when casting pointers...
  43.         bool m_visible;                //Used to cull with FogOfWar
  44. };
  45.  
  46. #endif